<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1" import="java.sql.*, support.*, java.util.*"%>
    
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>


<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link href="main.css" rel="stylesheet" type="text/css">
<title>Applications</title>
</head>
<body>
<h1>Applications</h1>
<%
	LinkedList<String> applicants = null;
	int specialization_id;
	int major_id;
	DatabaseAccessObject dao = new DatabaseAccessObject();
	if(request.getParameter("specialization_id") != null){
		specialization_id  = Integer.valueOf((String)request.getParameter("specialization_id"));
		applicants = dao.getApplicantNameBySpecialization(specialization_id);
	}
	else if(request.getParameter("major_id") != null){
		major_id  = Integer.valueOf((String)request.getParameter("major_id"));
		applicants = dao.getApplicantNameByMajor(major_id);
		
	}
	else{
		applicants = dao.getAllApplicantName();
	}
	
	pageContext.setAttribute("applicants", applicants);
%>

<ul>
    <c:forEach items="${applicants}" var="applicant">
    	<li>${applicant}</li>
    	<!-- <li><a href="\applicant.jsp?id=">${applicant}</a></li> -->
    </c:forEach>
</ul>

</body>
</html>